home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12862 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: lori.albany.net!usenet
  2. From: sb0781@albany.net (Stephen Behnfeldt)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Dynamically allocated interrupt handlers?
  5. Date: Fri, 22 Mar 1996 02:52:10 GMT
  6. Organization: AlbanyNet - E-mail info@albany.net
  7. Message-ID: <4it4o7$3ph@lori.albany.net>
  8. References: <4iqbv5$mqd@lori.albany.net> <3150C835.3433@airmail.net>
  9. NNTP-Posting-Host: pm2ip18-albny.albany.net
  10. X-Newsreader: Forte Free Agent v0.55
  11.  
  12. Mark Nelson <markn@airmail.net> wrote:
  13.  
  14. >Stephen Behnfeldt wrote:
  15. >> 
  16. >> I am building a SerialPort class to model the serial ports on my PC.
  17. >> Associated with each instance of this class are elements such as an
  18. >> input character buffer and a hardware address - data members which
  19. >> will be unique to each instance.
  20.  
  21. >> So it seems like each handler will have to be
  22. >> distinct - one for each instance of the class.
  23.  
  24. >You can minimize this pretty easily.  Instead of having N interrupt handlers, 
  25. >you just code N different entry points. The entry points looks something like
  26. >this:
  27.  
  28. >_interrupt isr0()
  29. >{
  30. >   handler(0);
  31. >}
  32.  
  33. >_interrupt isr1()
  34. >{
  35. >    handler(1);
  36. >}
  37.  
  38. >...
  39.  
  40. >Then, your handler routine simply uses the number as an index into a
  41. >table of pointers.  The table has pointers to C++ objects, which then
  42. >means you are back in object oriented land, where you belong.
  43.  
  44. >I cover this in some detail in my book "Serial Communications: A C++
  45. >Developer's Guide."  For more information on the book, follow the
  46. >links on my home page.
  47.  
  48. >Mark Nelson
  49. >http://web2.airmail.net/markn
  50.  
  51. This would make it easier to code a finite number of handlers; but
  52. what about coding for an indeterminate number of hardware devices?
  53.  
  54.  
  55. --spb
  56.  
  57.  
  58.